package com.vip.admin.common.utils;

import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.apache.shiro.crypto.hash.SimpleHash;
public class PasswordShiroUtils {
	
	final static int hashIterations = 2;//散列次数
	
	public static String getSalt() {
		SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
		return secureRandom.nextBytes(16).toHex();
	}
	
	public static String getPassword(String password,String salt){
		SimpleHash hash = new SimpleHash("md5", password, salt,hashIterations);
		return hash.toString();
	}
	
}
